package com.diankangwo.dao.impl;

import com.diankangwo.dao.WalletPayLogDAO;
import com.diankangwo.domain.WalletPayLog;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class WalletPayLogDAOImpl extends BaseDaoImpl<WalletPayLog> implements WalletPayLogDAO {
    @Override
    public List<WalletPayLog> getWalletPayLogList(int uid, String type) {
        List<WalletPayLog> userList = new ArrayList<WalletPayLog>();
        userList = findByQuery("from WalletPayLog wpl where wpl.uid = ? and wpl.title = ?", uid, type);
        if (userList == null || userList.size() == 0) {
            return null;
        } else {
            return userList;
        }
    }

    @Override
    public WalletPayLog getWalletPayLogByOrderNo(String orderNo) {
        List<WalletPayLog> walletPayLogList = findByQuery("from WalletPayLog wpl where wpl.billNo=?", orderNo);
        if (walletPayLogList.size() > 0) {
            return walletPayLogList.get(0);
        } else {
            return null;
        }
    }
}
